package com.example.mutuaiinterlockingprotocolmonitor;


import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.widget.TabHost;

public class MainActivity extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.d("function", "onCreate 1");
		setContentView(R.layout.activity_main);
		Log.d("function", "onCreate 2");
		setTab();
		Log.d("function", "onCreate 3");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

    private void setTab()
    {
    	Log.d("function", "setTab start");
        //TabHost tabs = getTabHost();
        
        Intent intent = new Intent(this, EngineTest.class);
     
    	TabHost tabHost = getTabHost();
        //tabHost.setup( getLocalActivityManager() );
        Log.d("function", "setTab mid 1");
        
        TabHost.TabSpec spec = tabHost.newTabSpec("tag1");
        spec.setContent(intent);
        spec.setIndicator("EngineTest");
        tabHost.addTab(spec);
        
        
        intent = new Intent(this, RawXML.class);
        Log.d("function", "setTab mid 2");
        spec = tabHost.newTabSpec("tag2");
        spec.setContent(intent);
        spec.setIndicator("RawXML");
        tabHost.addTab(spec);
        
        intent = new Intent(this, DeviceControl.class);
        Log.d("function", "setTab mid 2");
        spec = tabHost.newTabSpec("tag3");
        spec.setContent(intent);
        spec.setIndicator("Connected Devices");
        tabHost.addTab(spec);
        
        tabHost.setCurrentTab(0);      
        
        //tabHost.getTabWidget().setOrientation(LinearLayout.VERTICAL);
        Log.d("function", "setTab end");
    }
    
}
